<?php
namespace Admin\Controller;
use Think\Controller;
class SystemController extends CommonController{
    public function index(){
        //实例化模型类
        $model = M('system');
        if(IS_POST){
            //处理提交数据
            $data = $model -> create();
            //dump($data);die;
            $data['isclose'] = isset($data['isclose']) ? 1 : 0;
            $data['ischarge'] = isset($data['ischarge']) ? 1 : 0;
            //dump($data);die;
            $result = $model -> save($data);
            if($result){
                //$this -> success('修改成功！',0);
                $this -> redirect('Admin/System/index');
            }else{
                $this -> error('修改失败！');
            }
        }else{
            $id = 1;
            $data = $model -> find($id);
            $this -> assign('data',$data);
            $this -> display();
        }
    }
}